Skip to content

chore: add cross-platform development scripts - #2

Merged
riken127 merged 5 commits into
mainfrom
chore/add-cross-platform-scripts
Jul 22, 2026
Merged

riken127 merged 5 commits into
mainfrom
chore/add-cross-platform-scripts

Conversation

@riken127

Copy link
Copy Markdown
Owner

Summary

Add a first-class cross-platform developer workflow for Windows, Ubuntu, and macOS.

This replaces the host-facing Bash-only scripts with a dependency-free Python task runner, adds native Visual Studio presets for Windows, provides environment bootstrap scripts for each supported host, and exercises Windows builds in CI.

Motivation

The existing project workflow assumed a Unix shell:

  • local commands invoked .sh files directly;
  • the Makefile depended on POSIX utilities and executable paths;
  • vcpkg bootstrapping only called bootstrap-vcpkg.sh;
  • service execution did not account for .exe files or Visual Studio configuration directories;
  • documentation described Linux as the only compiler environment;
  • CI did not validate Windows.

As a result, a normal PowerShell/Visual Studio setup could not use the documented configure, format, lint, migration, smoke-test, or template-initialization workflows.

What changed

Cross-platform task runner

  • Add scripts/dev.py as the common entry point for:
    • vcpkg bootstrapping;
    • configure, build, test, and verification;
    • formatting and clang-tidy;
    • local service execution;
    • PostgreSQL Compose lifecycle and migrations;
    • grpcurl smoke tests;
    • PostgreSQL readiness checks;
    • Docker builds;
    • ccache operations;
    • template initialization and cleanup.
  • Select bootstrap-vcpkg.bat on Windows and bootstrap-vcpkg.sh elsewhere.
  • Handle Windows executables and Visual Studio multi-configuration output directories.
  • Resolve LLVM tools from the conventional Windows installation directory.
  • Discover Homebrew's keg-only LLVM, bison, flex, and libpq tools on macOS.
  • Preserve argument boundaries for connection strings and JSON payloads by avoiding shell interpolation.
  • Replace the previous host-facing Bash helpers and point the Makefile at the Python runner.

The Linux container entrypoint remains a shell script because it executes inside the Linux runtime image.

Windows CMake support

  • Split the shared preset base from the Ninja-specific base.
  • Preserve the existing Ninja presets.
  • Add windows-debug and windows-release configure, build, and test presets using Visual Studio 2022 and x64.
  • Make the Python runner select windows-debug automatically on Windows.

Host environment setup

Add idempotent setup scripts:

  • scripts/setup-windows.ps1
    • installs tools with WinGet;
    • ensures the Visual Studio 2022 C++ workload is present;
    • installs grpcurl;
    • initializes and bootstraps vcpkg;
    • optionally installs Docker Desktop.
  • scripts/setup-ubuntu.sh
    • supports Ubuntu 24.04 or newer;
    • installs the compiler and development packages with apt;
    • installs a pinned grpcurl release;
    • initializes and bootstraps vcpkg;
    • optionally installs Docker and Compose.
  • scripts/setup-macos.sh
    • ensures Xcode Command Line Tools and Homebrew;
    • installs the required formulae;
    • initializes and bootstraps vcpkg;
    • optionally installs Docker Desktop.

Docker installation is deliberately opt-in because desktop installations may require interaction or a reboot, and Linux group changes require a new login.

CI and documentation

  • Add a windows-latest GitHub Actions job that configures, builds, tests, and checks formatting.
  • Exercise the Python runner in the existing Linux CI workflow.
  • Document Windows, Ubuntu, and macOS setup and usage.
  • Update repository agent guidance and template-usage documentation.
  • Update the integration-test skip message to reference the new smoke-test command.

Developer impact

A fresh host can now prepare the core project environment with one native command:

powershell -ExecutionPolicy Bypass -File scripts/setup-windows.ps1
bash scripts/setup-ubuntu.sh
# or
bash scripts/setup-macos.sh

After setup, the same task vocabulary works across platforms:

python scripts/dev.py configure
python scripts/dev.py build
python scripts/dev.py test
python scripts/dev.py verify

Unix users may use python3; the Makefile remains available as an optional wrapper.

Commit structure

  1. chore: replace shell workflows with Python runner
  2. build: add Visual Studio presets
  3. chore: add host environment setup scripts
  4. ci: verify Windows builds
  5. docs: document cross-platform workflows

Validation

Completed locally on Windows:

  • python -m py_compile scripts/dev.py using portable CPython 3.12.10;
  • python scripts/dev.py --help;
  • python scripts/dev.py format --check;
  • template initialization against an isolated git archive, including proto relocation;
  • cmake --list-presets=all;
  • Bash syntax checks for both Unix setup scripts;
  • PowerShell AST parsing for the Windows setup script;
  • git diff --check;
  • stale reference scan for removed host-facing shell scripts.

A full local configure/build/test was not possible because this workstation does not currently have the Visual Studio C++ workload or an initialized vcpkg checkout. The new Windows CI job is intended to provide that end-to-end platform verification.

@riken127
riken127 marked this pull request as ready for review July 22, 2026 13:09
@riken127
riken127 merged commit 0ea9eb3 into main Jul 22, 2026
1 of 2 checks passed
@riken127
riken127 deleted the chore/add-cross-platform-scripts branch July 22, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant